<%@page pageEncoding="UTF-8"%>
<%@include file="/common/common.jsp"%>
<%@include file="/common/skins/skin0/component.jsp" %>
<h:css href="/css/style1/style-custom.css"/>
<html>
<!-- 
  - Author(s): pengweiling
  - Date: 2012-07-16 13:28:11
  - Description:
-->
<head>
<title>收取房费及押金</title>
</head>
<body>

<table align="center" border="0" width="100%" class="form_table">
            <tr>
              <td class="form_label">
               房&nbsp;&nbsp;费
              </td>
              <td colspan="1">
                <h:text style="width:150px;" id="txtRate"/>
              </td>
              
              <td class="form_label">
                付款方式
              </td>
              <td colspan="1">
                <d:select style="width:200px;" nullLabel="请选择" dictTypeId="HMS_PAYMENT_TYPE"  id="txtRatePayType"/>
              </td>
             </tr>
             
            <tr>
              <td class="form_label">
               押&nbsp;&nbsp;金
              </td>
              <td colspan="1">
                <h:text  style="width:150px;" id="txtDeposit" value="0"/>
              </td>
              
              <td class="form_label">
                付款方式
              </td>
              <td colspan="1">
                <d:select style="width:200px;" nullLabel="请选择" dictTypeId="HMS_PAYMENT_TYPE" id="txtDepositPayType"/>
              </td>
             </tr>   
            <tr>
              <td class="form_label">
               备&nbsp;&nbsp;注
              </td>
              <td colspan="3">
                <h:textarea style="width:100%" id="remark"/>
              </td>
             </tr>
            <tr>
              <td colspan="4" align="center">
                <input type="button" class="button" value="确&nbsp;定" onclick="selectRecord();" >
                <input type="button" class="button" value="取&nbsp;消" onclick="window.close();">
              </td>
             </tr>           
          </table>
          
          <script>
            
            
            function initDeposit(){
               var marg = getCurrentModalArguments();
               if (!marg){
                 return;
               }
               var info = marg.Argument;
               if (info.walkinFlag == true){
                 $id("txtRate").setAttribute("readonly", "true");
                 $id("txtRate").value = info.amount;      
                 $id("txtDeposit").setAttribute("readonly", "true");
                 $id("txtDeposit").value = info.deposit;          
                                           
               }
            }
            initDeposit();

            function selectRecord(){
              var ret = new Array;
              
              //数据是否正确
              try{
                var rate = Number($id("txtRate").value || "");
                if (rate < 0){
                  alert('房费必须大于等于0!');
                  return;
                }
              }catch(e){
                alert('房费必须大于等于0!');
                return;
              }
              
              try{
                var rate = Number($id("txtDeposit").value || "");
                if (rate < 0){
                  alert('押金必须大于等于0!');
                  return;
                }                
              }catch(e){
                alert('押金必须大于等于0!');
                return;
              }
              
              ret[0] = {rate:{amount:$id("txtRate").value, 
                               paymentType:$id("txtRatePayType").value,
                               remark:$id("remark").value
                              },
                         desposit:{amount:$id("txtDeposit").value, 
                                    paymentType:$id("txtDepositPayType").value,
                                    remark:$id("remark").value
                                   }
              }                                                                              
              window.returnValue = ret;
              window.close();
            }
          </script>
</body>
</html>